local FightBehavior = require("gameLogic.fight.fightBehavior.FightBehavior")
local AutoBehavior = class("AutoBehavior", FightBehavior)
local FightHelper = require("gameLogic.fight.FightHelper")

function AutoBehavior:ctor()
    AutoBehavior.super.ctor(self)
end

function AutoBehavior:excute(battleReport)
    local skills = self._entity:getSkills()
    local result = {}
    for i = 1, #skills do
        if skills[i]:getSkilCooling() == 0 then
            table.insert(result, skills[i])
        end
    end
    local skill = self._entity:getNormalSKill()
    if #result > 0 then
        local index = math.random(1, #skills)
        skill = skills[index]
    end
    local target = skill:getTarget()
    local entitys = self:getSkillTargetEntity(target, skill)
    battleReport:addAttackSkillId(skill:getId())
    skill:actOn(entitys, battleReport)
    self._entity:dispatchActionEnd()
end

return AutoBehavior
